<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%>
<%@ include file="/static/commons/meta.jsp"%>
<%@ include file="/static/commons/ecsideJquery.jsp"%>
<%--<%@ include file="/static/commons/jquery-easyui.jsp"%>--%>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>${title}</title>
		<link rel="stylesheet" type="text/css" href="${ctx}/static/widgets/easyui/themes/default/easyui.css">

		<object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
			<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
		</object>

		<script type="text/javascript" src="${ctx}/static/widgets/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="${ctx}/static/widgets/easyui/locale/easyui-lang-zh_CN.js"></script>

		<script type="text/javascript" src="${ctx}/static/widgets/lodop/LodopFuncs.js"></script>

		<script type="text/javascript" src="${ctx}/static/widgets/h5upload/upload.js"></script>

		<style>
			.uploadBtn,.downloadedBtn{
				width:88px;
				height:28px;
				float: left;
				margin: 5px 0 5px 5px;
				cursor:pointer;
			}
			.uploadBtn {
				background-image:url("${ctx}/static/widgets/uploadify/view_btn.png");
			}
			#importFileUploader{margin-top:5px;margin-bottom:5px;}
			#importFileUploader,#importFileQueue{float:left;}
		</style>

		<script type="text/javascript">
			function changeStyle(obj){
			  	ec_showContent(obj,"700px");
			}

            function PrintOneURL(obj){
                PrintTwoURL($(obj).attr('url'));

            };

			function PrintTwoURL(urlStr){
                var url= location.protocol+"//"+location.host+urlStr;
//			    var url="http://192.168.1.106:8080"+$(obj).attr('url');
                debugger;
                LODOP=getLodop();
                LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_按网址打印");
//                LODOP.ADD_PRINT_URL(30,20,746,"95%", url);
                LODOP.ADD_PRINT_URL(30,20,"100%","100%",url);
                LODOP.SET_PRINT_STYLEA(0,"HOrient",2);
                LODOP.SET_PRINT_STYLEA(0,"VOrient",3);
                //		LODOP.SET_SHOW_MODE("MESSAGE_GETING_URL",""); //该语句隐藏进度条或修改提示信息
                //		LODOP.SET_SHOW_MODE("MESSAGE_PARSING_URL","");//该语句隐藏进度条或修改提示信息
                LODOP.PREVIEW();
			}


            function viewOriginalRecord(orderId,equId,deviceType,gasType){
                debugger;
			    var fileName=orderId+"_"+equId;
                if(deviceType=="3"){
                    var msgdiv='<div class="panel window messager-window" style="display: block; width: 278px; left: 400px; top: 0px; z-index: 9019; position: absolute;"><div class="panel-header panel-header-noborder window-header" style="width: 278px;"><div class="panel-title" style="">查看原始记录单</div><div class="panel-tool"></div></div><div id="messDiv" class="messager-body panel-body panel-body-noborder window-body" title="" style="width: 258px; height: auto;"><div>Content_Area</div><div style="clear:both;"></div><div class="messager-button"><a href="javascript:void(0)" class="l-btn" style="margin-left: 10px;"><span class="l-btn-left"><span class="l-btn-text" onclick="javascript:$(this).parent().parent().parent().parent().parent().remove()">关闭</span></span></a></div></div></div>';
                    var msgStr="";
                    var gasTypeIdArray=gasType.split(",");
                    if(gasTypeIdArray.length>0){
                        if(gasTypeIdArray.length>1){
                            for(var i=0;i<gasTypeIdArray.length;i++){

                                <%--msgStr+="<a href='${ctx}/template/viewOriginalRecord?fileName="+fileName+"_"+i+"' name='gasClickName' target='_blank' >查看 "+gasTypeIdArray[i]+" 原始单据</a><br>";--%>

                                msgStr+="<a url='${ctx}/template/viewOriginalRecord?fileName="+fileName+"_"+i+"' name='gasClickName' href='javascript:void(0)' onclick='PrintOneURL(this)' >查看 "+gasTypeIdArray[i]+" 原始单据</a><br>";



                            }
						}else{
                            	<%--msgStr+="<a href='${ctx}/template/viewOriginalRecord?fileName="+fileName+"' name='gasClickName' target='_blank' >查看 "+gasTypeIdArray[0]+" 原始单据</a><br>";--%>

                            msgStr+="<a url='${ctx}/template/viewOriginalRecord?fileName="+fileName+"' name='gasClickName' href='javascript:void(0)' onclick='PrintOneURL(this)' >查看 "+gasTypeIdArray[0]+" 原始单据</a><br>";


                        }



                        msgdiv=msgdiv.replace("Content_Area",msgStr);

                        $("body").append(msgdiv);
					}
				}else{
                    PrintTwoURL("${ctx}/template/viewOriginalRecord?fileName="+fileName);
                }
			}




		</script>
		<style type="text/css">
			.hidden{display: none;}
		</style>
	</head>
	<body>
		<div id="listContentId"></div>
		<c:if test="${fn:length(list) > 0 }">
			<c:set var="v0" value="${list[0].device_type }"></c:set>
		</c:if>
		<ec:table items="list" var="v" title="" width="100%"
			retrieveRowsCallback="process" filterRowsCallback="process"
			maxRowsExported="1000" pageSizeList="15,30,50,all" useAjax="false"
			rowsDisplayed="15" sortable="false" filterable="false"
			resizeColWidth="true" classic="true" minHeight="200"
			excludeParameters="checkAll,ID_,id"
			toolbarContent="extend status|pagejump|navigation|pagesize|refresh"
			action="${ctx}/makeController/viewList">
			<ec:row style="text-align:center;">
				<ec:column width="30" property="_0" title="序号" value="${GLOBALROWCOUNT}"/>  
				<ec:column property="device_type" title="设备类别">${v.device_type_ }</ec:column>
				<ec:column property="device_name" title="名称">${v.device_name }</ec:column>
				<ec:column property="device_manufactor" title="生产厂家">${v.device_manufactor }</ec:column>
				
				<!-- 气瓶 -->
				<c:if test="${v0 eq 1 }">
					<ec:column property="device_no" title="出厂编号">${v.device_no }</ec:column>
					<ec:column property="volume_category" title="容积" style="width: 70px;">${v.volume_category_ }</ec:column>
					<ec:column property="manufacture_date" title="出厂日期" style="width: 90px;">${v.manufacture_date }</ec:column>
				</c:if>
				<!-- 空呼 -->
				<c:if test="${v0 eq 2 }">
					<ec:column property="device_model" title="仪器型号">${v.device_model }</ec:column>
					<ec:column property="device_no" title="出厂编号">${v.device_no }</ec:column>
				</c:if>
				<!-- 气检仪 -->
				<c:if test="${v0 eq 3 }">
					<ec:column property="device_model" title="仪器型号">${v.device_model }</ec:column>
					<ec:column property="device_no" title="出厂编号">${v.device_no }</ec:column>
					<ec:column property="gas_type" title="气体种类">${empty v.gas_type ? "/" : v.gas_type_}</ec:column>
				</c:if>
				<ec:column property="inspect_date" title="送检日期">${v.inspect_date }</ec:column>
				<ec:column property="complate_date" title="完成日期" style="width: 110px; white-space: initial;">${v.complate_date }</ec:column>
				<ec:column property="inspect_user" title="检测人" style="width: 110px; white-space: initial;">${v.inspect_user }</ec:column>
				<ec:column property="check_user" title="核验人" style="width: 70px;">${v.check_user }</ec:column>
				<ec:column property="c" title="检查结果">
					合格
				</ec:column>
				<ec:column property="if_cert" title="原始记录" style="width: 70px;">
					<c:if test="${v0 eq 3 || v0 eq 1 ||  v0 eq 2 }">
						<a href="javascript:void(0)" onclick="viewOriginalRecord('${v.order_id}','${v.equ_id}','${v.device_type }','${v.gas_type_}')">查看</a>
					</c:if>
				</ec:column>

				<c:if test="${v.save_path!=null && v.save_path!='' && v.save_path!='null'}">
					<ec:column property="if_cert" title="制证证书" style="width: 70px;">制作完成 </ec:column>
				</c:if>
				<c:if test="${v.save_path == null || v.save_path=='' || v.save_path=='null'}">
					<c:if test="${v0 eq 3}">
					<ec:column property="if_cert" title="制证证书" style="width: 70px;"><a href="${ctx}/makeController/doMakeCertificate?scopes=${v.scopes}&gasType=${v.gas_type_}&orderId=${v.order_id}&equId=${v.equ_id}" target="_blank" >开始制作</a> </ec:column>
					</c:if>
					<c:if test="${v0 eq 2}">
						<ec:column property="if_cert" title="制证证书" style="width: 70px;"><a href="${ctx}/makeController/doMakeCertificate?scopes=${v.scopes}&gasType=kh&orderId=${v.order_id}&equId=${v.equ_id}" target="_blank" >开始制作</a> </ec:column>
					</c:if>
					<c:if test="${v0 eq 1}">
						<ec:column property="if_cert" title="制证证书" style="width: 70px;"><a href="${ctx}/makeController/doMakeCertificate?scopes=${v.scopes}&gasType=qp&orderId=${v.order_id}&equId=${v.equ_id}" target="_blank" >开始制作</a> </ec:column>
					</c:if>
				</c:if>
				<c:if test="${v.save_path!=null && v.save_path!='' && v.save_path!='null'}">
					<ec:column property="if_cert" title="证书查看" style="width: 70px;"><a href="${ctx}/makeController/showCertificate?orderId=${v.order_id}&equId=${v.equ_id}" target="_blank" >查看证书</a></ec:column>
				</c:if>
				<c:if test="${v.save_path == null || v.save_path=='' || v.save_path=='null'}">
					<ec:column property="if_cert" title="证书查看" style="width: 70px;"></ec:column>
				</c:if>
				<ec:column property="if_cert" title="保存影件" style="width: 70px;"><a href="javascript:void(0)" id="up_${v.equ_id}">上传影件</a><script>$.fileUpload({ filebutton: '#up_${v.equ_id}',url:'${ctx}/makeController/saveShadow?orderId=${v.order_id}&equId=${v.equ_id}'});</script></ec:column>
				<ec:column property="if_cert" title="查看影件" style="width: 70px;"><a href="${ctx}/makeController/showShadow?orderId=${v.order_id}&equId=${v.equ_id}" target="_blank" >查看影件</a></ec:column>

			</ec:row>
			
		</ec:table>

	</body>
</html>